package cn.wolfcode.trip.base.mapper;

import cn.wolfcode.trip.base.domain.News;
import cn.wolfcode.trip.base.query.NewsQueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface NewsMapper {
    int deleteByPrimaryKey(Long id);

    int insert(News record);

    News selectByPrimaryKey(Long id);

    List<News> selectForList(NewsQueryObject qo);

    int updateByPrimaryKey(News record);

    void insertRelations(@Param("userId") Long userId, @Param("newsId") Long newsId);

    void deleteRelations(@Param("newsId") Long newsId);

    void deleteRelation(@Param("userId") Long userId, @Param("newsId") Long newsId);

    int countNewesByType(@Param("type") Integer type, @Param("newsId") Long newsId);

    List<News> selectByType(@Param("type") Integer type, @Param("newsId") Long newsId);

    List<News> selectAll(@Param("newsId") Long newsId);

    List<News> selectByUserId(Long userId);
}